There is a need for a way to create a single, unified, semantically correct source code program given N parallel versions. Such parallelism typical stems from multi-user development environments whereby individual changes are made by separate bodies or organizations. For example, in collaborative software development, multiple developers may edit a single file concurrently, resulting in multiple potentially conflicting versions of that file. Another example is software development for multiple platforms.
Many code versioning systems that exist today perform only bi-way merges; N-way merging is realized as multiple bi-way merges. However, this approach suffers from the problem of merge conflicts. Conflicts are caused when there are dissimilar changes to the same line(s) of source code in more than one instance in the N-way merge. Consider a 3-way merge of programs O (original), A and B. If both versions A and B contain different changes (addition/deletion/modification) to one or more identical lines, then a conflict occurs. For example:
Code O:Code A:Code B:AAABXY<-- conflict occurs.CCCDDDTraditionally, conflicts of this nature are handled manually by the developer, typically by editing any special annotations in the code indicating that a conflict has occurred.